package com.trimps.wifi.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.trimps.wifi.service.CartogramDataService;

@Controller
@RequestMapping(value = "data/")
public class CartogramDataController extends BaseController {
    private static final Logger logger = Logger.getLogger(CartogramDataController.class);

    @Autowired
    private CartogramDataService cartogramService;

    @RequestMapping(value = "cartogram")
    public String showCartogramPage() {
    	return "data/cartogram";
    }
    
    /**
     * 获取列表信息
     * @param keyWord
     * @return
     */
    @RequestMapping(value = "cartogramData", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> getFlowListByKeyword(
                    @RequestParam(value="deviceNo", required = false) String deviceNo,
                    @RequestParam(value="selectDate", required = false) String selectDate)  {
     // 返回用
        int totalCount = cartogramService.getCartogramDataCount(deviceNo, selectDate);
        Map<String, Object> map = new HashMap<String, Object>();
        List<Map<String, Object>> lst = cartogramService.getCartogramData(deviceNo, selectDate);
        map.put("dataInfo", lst);
        map.put("totalCount", totalCount);
        return map;
    }
    
    
}
